package com.wry.timing;

import com.wry.api.SpikeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Slf4j
@Component
public class StockSync {

    @Resource
    private SpikeService spikeService;

    /**
     * 5min / sync stock
     */
    @Scheduled(fixedRate = 1000L * 60L * 5L)
    public void syncStock(){
        log.info("~~~~~~库存同步开始~~~~~~~~~~~");
        spikeService.sync();
        log.info("=========库存同步结束=========");
    }
}
